import react, { ReactElement } from 'react'
import {useParams, useSearchParams } from "react-router-dom";

const RouterTest=():ReactElement=>{
    const [searchParams, setSearchParams] = useSearchParams()
    let params = useParams()

    return (
        <div style={{width:"100%",marginTop:"50px", marginLeft:"50px", fontSize:"20px"}}>
            React-Router Test:
            <div> · category={params.category}</div>    {/*   /RouterTest/:id          */}
            <div> · id={params.id}</div>    {/*   /RouterTest/:id          */}
            <div> · name={searchParams.get("name")}</div> {/*   /RouterTest/:id?name=XXXX           */}
        </div>
    );
}

export default RouterTest;

